<template>
	<view class="pages">
		<uni-nav-bar left-icon="left"  backgroundColor="#F5F7F8" @clickLeft="back" right-icon="trash" @clickRight="cancelAttionAll" title="关注旅游" />
		<view class="list-content">
			<roc-scroll @loadData="loadData" :visible_height="visible_height" :hasMore="hasMore"
				refresher_background="#fff" :data_number="data_number" :solt_height="solt_height" background="#fff"
				footer_background="#fff">
				<view class="list-content-inner" slot="data-content">
					<view class="item" v-for="(item,index) in data" :key="index" @click="todetail(item)">
						<image :src="item.image" mode=""></image>
						<view class="nums">
							<image src="https://qiniu-cdn.maeiyun.com/imgs/lvyou/xin.png" mode=""></image>
							<view class="">
								{{item.like_num}}
							</view>
						</view>
					</view>
				</view>
			</roc-scroll>
		</view>

	</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				// 滚动数据初始化
				visible_height: 60,
				solt_height: 0,
				page: 0,
				hasMore: true,
				data: [],
				data_number: 0,
				strateList: ['999'],
				allPage: 0,
				current: 0,
				userInfoAttion: {}
			}
		},
		onLoad() {
			this.loadData(0)
		},
		methods: {
			back() {
				uni.navigateBack()
			},
			cancelAttionAll(){
				let that = this
				this.request.httpTokenRequest({
					url: "tour/closeCollect",
					method: "POST"
				}, {}).then(res => {
					if (res.code == 0) {
						this.loadData(1)
						this.$util.msg(res.msg)
					} else {
						this.$util.msg(res.msg)
						return
					}
				}, error => {})
			},
			todetail(item) {
				uni.navigateTo({
					url: "/otherpages/video/index/index?id=" + item.id
				})
			},
			loadData(type, callback) {
				if (type == 1) {
					this.page = 0
					this.data = []
				}
				let that = this
				this.request.httpTokenRequest({
					url: "user/collectTour",
					method: "get"
				}, {
					page: this.page
				}).then(res => {
					if (res.code == 0) {
						that.allPage = res.data.total
						// 把后端数据赋给页面
						that.data = [...that.data, ...res.data.data];

						that.data_number = that.data.length
						that.page++
						// 隐藏加载条 重置下拉 上拉状态
						if (res.data.last_page == res.data.per_page) {
							that.hasMore = false
						}
						if (type) callback(false)

					} else {
						that.$util.msg(res.msg)
						return
					}
				}, error => {})
			}
		}
	}
</script>

<style lang="scss">
	.uni-navbar__header {
		font-size: 40rpx !important;
	}
	.pages{
		padding-top: var(--status-bar-height);
	}
	.list-type {
		display: flex;
		align-items: flex-end;
		justify-content: space-around;
		margin-top: 20rpx;

		.item-type {
			width: 40%;
			text-align: center;
			padding: 10rpx 0;
			font-size: 30rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 400;
			color: #1E1E1E;
			border-bottom: 4rpx solid #F5F7F8;
		}

		.select-type {
			font-weight: bold;
			border-bottom: 4rpx solid #C6C7C8;
		}
	}

	.list-content {
		// margin-top: 30rpx;
		border-radius: 20rpx;
		padding: 0 24rpx;
	}

	//
	.list-content-inner {
		display: flex;
		align-items: center;
		justify-content: space-between;
		background: #fff;
		padding: 30rpx;
		flex-wrap: wrap;
	}
	.item {
		width: 48%;
		// padding: 10rpx 20rpx;
		flex: 0 0 auto;
		border-radius: 10rpx;
		position: relative;
		overflow: hidden;

		image {
			width: 100%;
			height: 409rpx;
		}

	}

	.nums {
		display: flex;
		align-items: center;
		font-size: 28rpx;
		font-family: PingFangSC, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		position: absolute;
		bottom: 23rpx;
		left: 21rpx;

		image {
			width: 49rpx;
			height: 42rpx;
			margin-right: 11rpx;
		}
	}
</style>